/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bs.beans.fiscal;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

/**
 *
 * @author Bone
 */
@Entity
@Table(name = "NF_REFERENCIADA")
public class NfReferenciada implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID")
    private Integer id;
    @Column(name = "CHAVE")
    private String chave;
    @Column(name = "UF")
    private Short uf;
    @Column(name = "ANO_MES")
    @Temporal(TemporalType.DATE)
    private Date anoMes;
    @Column(name = "CPF_CNPJ")
    private String cpfCnpj;
    @Column(name = "MODELO")
    private String modelo;
    @Column(name = "SERIE")
    private Short serie;
    @Column(name = "NUMERO")
    private Integer numero;
    @Column(name = "CPF")
    private String cpf;
    @Column(name = "INSCRICAO_ESTADUAL")
    private String inscricaoEstadual;
    @Column(name = "CHAVE_ACESSO_CTE")
    private String chaveAcessoCte;
    @Column(name = "ECF")
    private Short ecf;
    @Column(name = "COO")
    private Integer coo;
    @JoinColumn(name = "NOTA_FISCAL", referencedColumnName = "ID", updatable = false, insertable = false)
    @ManyToOne
    private NotaFiscal notaFiscal;

    public NfReferenciada() {
    }

    public NfReferenciada(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        Integer oldId = this.id;
        this.id = id;
        changeSupport.firePropertyChange("id", oldId, id);
    }

   
    public String getChave() {
        return chave;
    }

    public void setChave(String chave) {
        String oldChave = this.chave;
        this.chave = chave;
        changeSupport.firePropertyChange("chave", oldChave, chave);
    }

    public Short getUf() {
        return uf;
    }

    public void setUf(Short uf) {
        Short oldUf = this.uf;
        this.uf = uf;
        changeSupport.firePropertyChange("uf", oldUf, uf);
    }

    public Date getAnoMes() {
        return anoMes;
    }

    public void setAnoMes(Date anoMes) {
        Date oldAnoMes = this.anoMes;
        this.anoMes = anoMes;
        changeSupport.firePropertyChange("anoMes", oldAnoMes, anoMes);
    }

    public String getCpfCnpj() {
        return cpfCnpj;
    }

    public void setCpfCnpj(String cpfCnpj) {
        String oldCpfCnpj = this.cpfCnpj;
        this.cpfCnpj = cpfCnpj;
        changeSupport.firePropertyChange("cpfCnpj", oldCpfCnpj, cpfCnpj);
    }

    public String getModelo() {
        return modelo;
    }

    public void setModelo(String modelo) {
        String oldModelo = this.modelo;
        this.modelo = modelo;
        changeSupport.firePropertyChange("modelo", oldModelo, modelo);
    }

    public Short getSerie() {
        return serie;
    }

    public void setSerie(Short serie) {
        Short oldSerie = this.serie;
        this.serie = serie;
        changeSupport.firePropertyChange("serie", oldSerie, serie);
    }

    public Integer getNumero() {
        return numero;
    }

    public void setNumero(Integer numero) {
        Integer oldNumero = this.numero;
        this.numero = numero;
        changeSupport.firePropertyChange("numero", oldNumero, numero);
    }

    public String getCpf() {
        return cpf;
    }

    public void setCpf(String cpf) {
        String oldCpf = this.cpf;
        this.cpf = cpf;
        changeSupport.firePropertyChange("cpf", oldCpf, cpf);
    }

    public String getInscricaoEstadual() {
        return inscricaoEstadual;
    }

    public void setInscricaoEstadual(String inscricaoEstadual) {
        String oldInscricaoEstadual = this.inscricaoEstadual;
        this.inscricaoEstadual = inscricaoEstadual;
        changeSupport.firePropertyChange("inscricaoEstadual", oldInscricaoEstadual, inscricaoEstadual);
    }

    public String getChaveAcessoCte() {
        return chaveAcessoCte;
    }

    public void setChaveAcessoCte(String chaveAcessoCte) {
        String oldChaveAcessoCte = this.chaveAcessoCte;
        this.chaveAcessoCte = chaveAcessoCte;
        changeSupport.firePropertyChange("chaveAcessoCte", oldChaveAcessoCte, chaveAcessoCte);
    }

    public Short getEcf() {
        return ecf;
    }

    public void setEcf(Short ecf) {
        Short oldEcf = this.ecf;
        this.ecf = ecf;
        changeSupport.firePropertyChange("ecf", oldEcf, ecf);
    }

    public Integer getCoo() {
        return coo;
    }

    public void setCoo(Integer coo) {
        Integer oldCoo = this.coo;
        this.coo = coo;
        changeSupport.firePropertyChange("coo", oldCoo, coo);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof NfReferenciada)) {
            return false;
        }
        NfReferenciada other = (NfReferenciada) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.bs.beans.fiscal.NfReferenciada[ id=" + id + " ]";
    }

    public NotaFiscal getNotaFiscal() {
        return notaFiscal;
    }

    public void setNotaFiscal(NotaFiscal notaFiscal) {
        NotaFiscal oldNotaFiscal = this.notaFiscal;
        this.notaFiscal = notaFiscal;
        changeSupport.firePropertyChange("notaFiscal", oldNotaFiscal, notaFiscal);
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
    
}
